const { completeRequire } = require('../util/core')

const beforeMiddlewares = [
    require('./AuthMiddleware'), // 鉴权
    require('./MulterUploadMiddleware'), // 文件上传
    // require('./ModelsBindMiddleware'), // 绑定模型
    require('./AccessLogMiddleware'), // 访问日志
]
const afterMiddlewares = [
    require('./ResponseLogMiddleware')
]

module.exports = {
    install: function (app, pos = 'before') {
        if(pos === 'after') afterMiddlewares.forEach(middleware => app.use(middleware));
        else beforeMiddlewares.forEach(middleware => app.use(middleware));
    }
}